Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Functions / Functions for Connectionless Transactionless Endpoints


OTSndUData

Sends data using a connectionless transactionless endpoint.

C INTERFACE
OSStatus OTSndUData (EndpointRef ref, TUnitData* udata);
C++ INTERFACE
OSStatus TEndpoint::SndUData(TUnitData* udata);
PARAMETERS
ref
The endpoint reference of the endpoint sending the data.
udata
A pointer to a TUnitData structure (page 3-55) that specifies the data to be sent and its destination.
DESCRIPTION
If the endpoint is in synchronous, blocking mode, the OTSndUData function returns immediately. If flow-control restrictions prevent its sending the data, it retries the operation until it is able to send it. If the endpoint is in nonblocking mode, the OTSndUData function returns a kOTFlowErr result if flow-control restrictions prevent the data from being sent. When the endpoint provider is able to send the data, it calls your notifier function, passing T_GODATA for the code parameter. You can then call the OTSndUData function from your notifier to send the data. You can also retrieve this event by polling the endpoint using the OTLook function.

Some endpoint providers are not able to detect immediately whether you specified incorrect address or option information. In such cases, the provider calls your notifier function when it detects the error, passing the T_UDERR for the code parameter to advise you that an error has occurred. You can determine the cause of this event by calling the OTRcvUDErr function and examining the value of the uderr->error parameter. It is important that you call the OTRcvUDErr function even if you are not interested in examining the cause of the error. Failing to do this leaves the endpoint in an invalid state for doing other sends and makes the endpoint provider unable to deallocate memory reserved for internal buffers associated with the send.

The next table shows how the endpoint's mode of execution and blocking status affects the behavior of the OTSndUData function.
 BlockingNonblocking
SynchronousThe function returns when the provider lifts flow-
control restrictions.
The function returns immediately.
 The kOTFlowErr result is never returned.The kOTFlowErr result might be returned.
AsynchronousThe function returns immediatelyThe function returns immediately
 The kOTFlowErr result is never returned.The kOTFlowErr result might be returned.

SPECIAL CONSIDERATIONS
The XTI_SLOWAT option allows endpoints that support it to negotiate the minimum number of bytes that must have accumulated in the endpoint's internal send buffer before they are sent. If the endpoint you are using supports this option, you can negotiate a value using the OTOptionManagement function. Because you use the OTOptionManagement function to set this option, it affects all subsequent sends.

VALID STATES
T_IDLE

SEE ALSO
To read the data, the endpoint to which the data is sent uses the OTRcvUData function, (page 3-105).

You use the TUnitData structure (page 3-55) to specify the data to be sent and its destination.

You use the OTData structure (page 3-52) to transfer noncontiguous data.

You use the OTOptionManagement function, described in the reference section of the chapter "Option Management" in this book to negotiate a value for the XTI_SNDLOWAT option.

You use the OTRcvUDErr function (described next) to retrieve information about the cause of a T_UDERR event.

For information on how to use this function with a TCP/IP protocol, see page 8-18 in the TCP/IP chapter.

For information on how to use this function with the AppleTalk DDP protocol, see page 12-11 in the DDP chapter.

You use the OTLook function (page 3-85) to retrieve pending asynchronous events for an endpoint.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996